package cn.stronglink.esm27.collection.iot;

import java.util.Iterator;
import java.util.Map.Entry;

import org.springframework.context.support.AbstractApplicationContext;
import org.springframework.context.support.ClassPathXmlApplicationContext;

import cn.stronglink.esm27.collection.iot.devices.algorithmservice.algorithm.GasDispersionAlgorithmFactory;
import cn.stronglink.esm27.collection.iot.devices.algorithmservice.algorithm.IAlgorithmFactory;

public class Booter {

	private static AbstractApplicationContext ctx;
 
	public static void main(String[] args)  {

		Booter.printSystemInfo();
		String[] configFile = { "application-context.xml" };
		ctx = new ClassPathXmlApplicationContext(configFile);
		ctx.registerShutdownHook();
		ctx.start();
		while(true) {
			try {
				Thread.sleep(10000);
			} catch (InterruptedException e) {
				e.printStackTrace();
			}
		}

	}
	
	/**
	 * 打印系统信息
	 */
	private static void printSystemInfo() {
		String osName = System.getProperty("os.name");
		String osBit = System.getProperty("os.arch");
		String osVersion = System.getProperty("os.version");
		System.out.println("================操作系统:"+osName+"================");
		System.out.println("Version:"+osVersion+"    Bit:"+osBit);
		System.out.println("------------------------------------------------");
		Iterator<Entry<Object, Object>> it = System.getProperties().entrySet().iterator();  
        while (it.hasNext()) {  
            Entry<Object, Object> entry = it.next();  
            Object key = entry.getKey();  
            Object value = entry.getValue(); 
            System.out.println(key+"="+value); 
        } 
		System.out.println("================================================");
	}
}
